package day05.bigdecimal;

import java.math.BigDecimal;

public class Lian02 {
    public static void main(String[] args) {
        BigDecimal b1=new BigDecimal("0.1");
        BigDecimal b2=new BigDecimal("0.2");
        BigDecimal add = b1.add(b2);
        System.out.println("和为"+add);
        System.out.println(0.1+0.2);
        System.out.println("----------");
        BigDecimal subtract = b1.subtract(b2);
        System.out.println("差为"+subtract);
//        System.out.println("差为"+(0.1-0.2));
        System.out.println("----------");
        BigDecimal multiply = b1.multiply(b2);
        System.out.println("相乘为"+multiply);
        System.out.println("----------");
        BigDecimal divide = b1.divide(b2);
        System.out.println("相除为"+divide);
    }
}
